package com.dawn.socket;

import java.util.HashMap;

public class HandlerFactory {

	private HashMap<String, IHandler> handlerMap = new HashMap<String, IHandler>();
	private static HandlerFactory instance;

	private HandlerFactory() {
	}

	public static HandlerFactory getInstance() {

		if (instance == null) {
			HandlerFactory instance = new HandlerFactory();
			instance.handlerMap.put("1", new LoginHandler());
			instance.handlerMap.put("1-12", new MessageHandler());
		}

		return instance;
	}

	public IHandler getHandler(int op) {

		return handlerMap.get(String.valueOf(op));
	}

}
